<?php

 
 Zend_Loader::loadClass("BaseDBRows");
 Zend_Loader::loadClass("Tank");
 class Tanks extends BaseDBRows
 {
 	protected function setUp()
 	{
 		$this->_tableName = Tank::_tablename;
 	}	
	
	public function getInvTankByOrgId($orgId)
	{
		Zend_Loader::loadClass("QueryCreator");
		Zend_Loader::loadClass("Inventory");
		
		$query = new QueryCreator();
		$query->addSelect("t.tank_id, t.name tank_name");
		$query->addFrom($this->_tableName . " t ");
		$query->addJoin("," . Inventory::_tablename . " i ");
		$query->addWhere("t.tank_id = i.tank_id");
		$query->addWhere(" i.org_id = " . $orgId);
		$query->addGroupBy(" t.tank_id, t.name ");
		
		$db = DBCon::instance();
		$result = $db->executeQuery($query->createSQL());
		return $result;
		
	}
	
	
	
 }
?>